import { NestFactory } from '@nestjs/core';
import { GatewayModule } from './gateway.module';
import config from '../config/index';
import { GlobalExceptionFilter } from 'libs/common/filters/GlobalException.filter';
import { ValidationPipe } from '@nestjs/common';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';

async function bootstrap() {
  const app = await NestFactory.create<NestFastifyApplication>(GatewayModule, new FastifyAdapter());
  app.useGlobalFilters(new GlobalExceptionFilter());
  app.useGlobalPipes(new ValidationPipe());

  await app.listen(config.port);
  console.log(`${config.serviceName}:[http://127.0.0.1:${config.port}]`);
}
bootstrap();
